package com.huaxin.hxenum.validator;

import com.huaxin.hxenum.enums.BreakerStatus;
import com.huaxin.hxenum.validation.ValidBreakerStatus;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class BreakerStatusValidator implements ConstraintValidator<ValidBreakerStatus, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if (value == null || value.trim().isEmpty()) {
            return true; // 交由 @NotNull 等处理非空逻辑
        }
        return BreakerStatus.isValid(value);
    }
}